﻿using System;
using System.Configuration;

namespace CodeContribBlog.Web.Mvc
{
	public static class AppConfig
	{
		private static readonly bool _isConfigured;

		public static bool EnableRouteDebugger { get; set; }
		public static string ReCaptchaPrivateKey { get; set; }
		public static string ReCaptchaPublicKey { get; set; }
		public static string RootUrl { get; set; }
		public static string UploadsPath { get; set; }
		public static string UserAgent { get; set; }

		static AppConfig()
		{
			if (_isConfigured)
			{
				return;
			}

			EnableRouteDebugger = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableRouteDebugger"]);
			ReCaptchaPrivateKey = Convert.ToString(ConfigurationManager.AppSettings["ReCaptchaPrivateKey"]);
			ReCaptchaPublicKey = Convert.ToString(ConfigurationManager.AppSettings["ReCaptchaPublicKey"]);
			RootUrl = Convert.ToString(ConfigurationManager.AppSettings["RootUrl"]);
			UploadsPath = Convert.ToString(ConfigurationManager.AppSettings["UploadsPath"]);
			UserAgent = Convert.ToString(ConfigurationManager.AppSettings["UserAgent"]);

			_isConfigured = true;
		}
	}
}